<template>
  <div class="box">
      <h1>我是子组件Header</h1>
      <ul>
        <li @click="sendCar">吃饭</li>
        <li @click="sendCar">睡觉</li>
        <li @click="sendCar">打豆豆</li>
      </ul>
  </div>
</template>

<script>
export default {
  name: 'Header',
  methods: {
      sendCar(){
        //事件源:Header组件的实例触发自定义事件$emit
        this.$emit('erha','法拉利');
      }
  },
}
</script>

<style scoped lang="less">
   div.box{
       width: 400px;
       height: 200px;
       margin: 100px auto;
       background: red;
   }
</style>
